package com.xx;

import com.xx.api.OrderService;
import com.xx.api.PayService;
import com.xx.api.tcc.TccOrderService;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;

@Service
public class OrderAndPayService {

    @Reference(timeout = 50000,retries = 0)
    private OrderService orderService;

    @Reference(timeout = 50000,retries = 0)
    private PayService payService;

    @Reference(timeout = 50000,retries = 0)
    private TccOrderService tccOrderService;

    @GlobalTransactional
    public void test() {
        orderService.update();
        payService.pay();
    }

    @GlobalTransactional
    public void tccTest(){
        tccOrderService.ttry(null);
    }
}
